﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Composite.TransparentDept
{
    public class TransparentDept : ITransparentDept
    {
        string name;
        List<ITransparentDept> deptList;
        public TransparentDept(string name)
        {
            this.name = name;
            deptList = new List<ITransparentDept>();
        }
        public void AddDept(ITransparentDept dept)
        {
            this.deptList.Add(dept);
        }
        public void RemoveDept(ITransparentDept dept)
        {
            this.deptList.Remove(dept);
        }
        public List<ITransparentDept> GetChild()
        {
            return this.deptList;
        }
        public void Display(string pre)
        {
            System.Console.Write(pre+name + "\n");
            foreach (var item in this.deptList)
            {
                item.Display(pre+"----");
            }
        }
    }
}
